home *** CD-ROM | disk | FTP | other *** search
- this.init = function()
- {
- this.pPosX = this.pPosY = 3;
- this.pPosNum = this.pPosY * 8 + this.pPosX;
- this._x = 20 + (this.pPosX - 4) * 40;
- this._y = 20 + (this.pPosY - 4) * 40;
- this.pSelection = -1;
- this.pActive = false;
- this.pVisible = true;
- this.hilite1_mc._visible = false;
- this.hilite2_mc._visible = false;
- this.hilite3_mc._visible = false;
- this.hilite4_mc._visible = false;
- this.hideSelector();
- this.pSelectSnd = new Sound(this);
- this.pSelectSnd.attachSound("snd.select");
- };
- this.setActive = function(tState)
- {
- this.pActive = tState;
- if(tState)
- {
- this._x = 20 + (this.pPosX - 4) * 40;
- this._y = 20 + (this.pPosY - 4) * 40;
- }
- };
- this.hideSelector = function()
- {
- this._y = -200;
- };
- this.removeSelector = function()
- {
- this.removeMovieClip();
- };
- this.moveSelect = function(aX, aY)
- {
- this.pPosX += aX;
- this.pPosY += aY;
- this.pPosX = Math.max(0,Math.min(7,this.pPosX));
- this.pPosY = Math.max(0,Math.min(7,this.pPosY));
- this._x = 20 + (this.pPosX - 4) * 40;
- this._y = 20 + (this.pPosY - 4) * 40;
- if(this.pSelection != -1)
- {
- if(this.pSelection != this.pPosY * 8 + this.pPosX)
- {
- this._parent.swapBlocks(this.pSelection,this.pPosY * 8 + this.pPosX);
- this.pSelection = -1;
- this.gotoAndStop("hilite");
- this.hilite1_mc._visible = false;
- this.hilite2_mc._visible = false;
- this.hilite3_mc._visible = false;
- this.hilite4_mc._visible = false;
- }
- }
- };
- this.pressSelect = function()
- {
- if(this.pActive)
- {
- if(this.pSelection == -1)
- {
- this.pSelection = this.pPosY * 8 + this.pPosX;
- this.gotoAndStop("select");
- this.hilite1_mc._visible = true;
- this.hilite2_mc._visible = true;
- this.hilite3_mc._visible = true;
- this.hilite4_mc._visible = true;
- this.pSelectSnd.start();
- }
- else
- {
- this.pSelection = -1;
- this.gotoAndStop("hilite");
- this.hilite1_mc._visible = false;
- this.hilite2_mc._visible = false;
- this.hilite3_mc._visible = false;
- this.hilite4_mc._visible = false;
- }
- }
- };
- this.init();
-